package com.ruoyi.school.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.school.mapper.NewGoodMapper;
import com.ruoyi.school.domain.NewGood;
import com.ruoyi.school.service.INewGoodService;

/**
 * 四新四好Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-08-31
 */
@Service
public class NewGoodServiceImpl implements INewGoodService 
{
    @Autowired
    private NewGoodMapper newGoodMapper;

    /**
     * 查询四新四好
     * 
     * @param id 四新四好主键
     * @return 四新四好
     */
    @Override
    public NewGood selectNewGoodById(Long id)
    {
        return newGoodMapper.selectNewGoodById(id);
    }

    /**
     * 查询四新四好列表
     * 
     * @param newGood 四新四好
     * @return 四新四好
     */
    @Override
    public List<NewGood> selectNewGoodList(NewGood newGood)
    {
        return newGoodMapper.selectNewGoodList(newGood);
    }

    /**
     * 新增四新四好
     * 
     * @param newGood 四新四好
     * @return 结果
     */
    @Override
    public int insertNewGood(NewGood newGood)
    {
        newGood.setCreateTime(DateUtils.getNowDate());
        return newGoodMapper.insertNewGood(newGood);
    }

    /**
     * 修改四新四好
     * 
     * @param newGood 四新四好
     * @return 结果
     */
    @Override
    public int updateNewGood(NewGood newGood)
    {
        newGood.setUpdateTime(DateUtils.getNowDate());
        return newGoodMapper.updateNewGood(newGood);
    }

    /**
     * 批量删除四新四好
     * 
     * @param ids 需要删除的四新四好主键
     * @return 结果
     */
    @Override
    public int deleteNewGoodByIds(Long[] ids)
    {
        return newGoodMapper.deleteNewGoodByIds(ids);
    }

    /**
     * 删除四新四好信息
     * 
     * @param id 四新四好主键
     * @return 结果
     */
    @Override
    public int deleteNewGoodById(Long id)
    {
        return newGoodMapper.deleteNewGoodById(id);
    }
}
